/*
 * Pawn.cpp
 *
 *  Created on: Mar 30, 2011
 *      Author: cnwilson
 */

#include "../inc/Pawn.h"


Pawn::Pawn(Color _color,Position _pos): Piece(_color,_pos,PAWN){

}

vector<Position> Pawn::getPotentialMoves(){
	vector<Position> moves,temp;
	if (color==WHITE){
		temp.push_back(pos+Position( -1, 0));
		temp.push_back(pos+Position( -1, 1));
		temp.push_back(pos+Position( -1,-1));
		if(pos.getRow()==BOARDSIZE-1)
			temp.push_back(pos+Position( -2,0));
	}
	else{
		temp.push_back(pos+Position( 1, 0));
		temp.push_back(pos+Position( 1, 1));
		temp.push_back(pos+Position( 1,-1));
		if(pos.getRow()==1)
			temp.push_back(pos+Position( 2,0));
	}

	for(int i=0; i<temp.size();i++)
		if(temp[i]>=0 && temp[i]<BOARDSIZE)
			moves.push_back(temp[i]);
	return moves;
}
